package app

import (
	"github.com/gin-gonic/gin"
	"strconv"
)

func GetPage(c *gin.Context) (int, error) {
	return strconv.Atoi(c.Query("page"))
}

func GetPageSize(c *gin.Context) (int, error) {
	return strconv.Atoi(c.Query("page_size"))
}

func GetPageOffset(page, pageSize int) int {
	result := 0
	if page > 0 {
		result = (page - 1) * pageSize
	}
	return result
}
